package DAO;

import java.sql.Connection;
import java.sql.DriverManager;

/**
 *
 * @author Rosana
 */
public class FactoryConnection {

    private static final String user = "postgres";
    private static final String password = "123";
    private static final String database = "Responda";
    //private static final String host = "192.168.1.78";
    private static final String host = "localhost";
    private static final String port = "5432";
    private static final String password2 = "0136311";
    private static final String password3 = "postgres";

    public static Connection getConnection() {
        Connection con = null;
        try {
            String url = "jdbc:postgresql://" + host + ":" + port + "/" + database
                    + "?user=" + user + "&password=" + password;
            con = DriverManager.getConnection(url);
        } catch (Exception e) {
           try {
            String url = "jdbc:postgresql://" + host + ":" + port + "/" + database
                    + "?user=" + user + "&password=" + password2;
            con = DriverManager.getConnection(url);
        } catch (Exception a) {
           
        }
        }
        return con;
    }
}
